package com.zhuiYun.project.api.slideshow.mapper;

import com.zhuiYun.project.api.slideshow.entity.SlideShowEntity;
import com.zhuiYun.project.api.slideshow.entity.SlideShowEntityVO;
import com.zhuiYun.project.common.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: SlideShowMapper
 * @descriptions: pc轮播图mapper
 * @Author: zq
 * @Date 2023/4/12 11:36
 */
public interface SlideShowMapper extends BaseMapper<SlideShowEntity> {
    /**
     * @description: pc轮播图管理index主页
     * @author: zq
     * @date: 2023/4/12 13:48
     * @param: []
     * @return: java.util.List<com.zhuiYun.project.api.slideshow.entity.SlideShowEntity>
    **/
    @Select("SELECT s.*,c.url\n" +
            "FROM slideshow s\n" +
            "LEFT JOIN carousel c\n" +
            "ON s.commdiy_id = c.id\n" +
            "WHERE s.delete_flag = 0 AND s.pc_or_app = 0 AND s.diycomm_type = 3")
    List<SlideShowEntityVO> slideShowByType();

    /**
     * @description: pc轮播图管理商品分类页
     * @author: zq
     * @date: 2023/4/12 14:17
     * @param: []
     * @return: java.util.List<com.zhuiYun.project.api.slideshow.entity.SlideShowEntityVO>
    **/
    @Select("SELECT s.*,d.back,c.url FROM slideshow s,carousel c,commodity d WHERE s.delete_flag = 0 AND s.pc_or_app = 0 AND s.diycomm_type = 2 AND s.carousel_id=d.id and s.commdiy_id = c.id")
    List<SlideShowEntityVO> slideShowByTypes();

    /**
     * @description: pc轮播图管理DIY页
     * @author: zq
     * @date: 2023/4/12 14:17
     * @param: []
     * @return: java.util.List<com.zhuiYun.project.api.slideshow.entity.SlideShowEntityVO>
     **/
    @Select("SELECT s.*,c.url\n" +
            "FROM slideshow s\n" +
            "LEFT JOIN carousel c\n" +
            "ON s.commdiy_id = c.id\n" +
            "WHERE s.delete_flag = 0 AND s.pc_or_app = 0 AND s.diycomm_type = 1")
    List<SlideShowEntityVO> slideShowByTypeDiy();
}
